<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <script src="G:\VsCode\WorkSpace\MyProject\web-utils-convert\dist\json-beautify.js"></script>
</head>
<body>

</body>

<script>

  let jsonContent = "{\"result\":[{\"id\":8,\"createTime\":\"2022-10-04 22:47:12\",\"updateTime\":\"2022-10-04 22:47:12\",\"isDel\":0,\"routerPath\":null,\"parentRouterName\":null,\"routerName\":null,\"routerComponent\":null,\"menuIcon\":\"location\",\"level\":1,\"name\":\"工具库\",\"parentId\":null,\"groupTitle\":null,\"sort\":1,\"type\":0,\"childrens\":[{\"id\":9,\"createTime\":\"2022-10-04 22:47:12\",\"updateTime\":\"2022-10-04 22:47:12\",\"isDel\":0,\"routerPath\":\"/figure-bed\",\"parentRouterName\":null,\"routerName\":\"FigureBedPage\",\"routerComponent\":\"FigureBedPage\",\"menuIcon\":null,\"level\":2,\"name\":\"图床\",\"parentId\":8,\"groupTitle\":null,\"sort\":1,\"type\":0,\"childrens\":[]},{\"id\":10,\"createTime\":\"2022-10-04 22:47:12\",\"updateTime\":\"2022-10-04 22:47:12\",\"isDel\":0,\"routerPath\":\"/short-chain\",\"parentRouterName\":null,\"routerName\":\"GenerateShortLinkPage\",\"routerComponent\":\"GenerateShortLinkPage\",\"menuIcon\":null,\"level\":2,\"name\":\"短链生成器\",\"parentId\":8,\"groupTitle\":null,\"sort\":2,\"type\":0,\"childrens\":[]},{\"id\":11,\"createTime\":\"2022-10-04 22:47:12\",\"updateTime\":\"2022-10-04 22:47:12\",\"isDel\":0,\"routerPath\":\"/generate-code\",\"parentRouterName\":null,\"routerName\":\"GenerateCodePage\",\"routerComponent\":\"GenerateCodePage\",\"menuIcon\":null,\"level\":2,\"name\":\"代码生成器\",\"parentId\":8,\"groupTitle\":null,\"sort\":3,\"type\":0,\"childrens\":[]}]},{\"id\":12,\"createTime\":\"2022-10-04 22:47:12\",\"updateTime\":\"2022-10-04 22:47:12\",\"isDel\":0,\"routerPath\":null,\"parentRouterName\":null,\"routerName\":null,\"routerComponent\":null,\"menuIcon\":\"icon-menu\",\"level\":1,\"name\":\"社交\",\"parentId\":null,\"groupTitle\":null,\"sort\":2,\"type\":0,\"childrens\":[]},{\"id\":16,\"createTime\":\"2022-11-01 04:13:25\",\"updateTime\":\"2022-11-01 04:13:25\",\"isDel\":0,\"routerPath\":null,\"parentRouterName\":null,\"routerName\":null,\"routerComponent\":null,\"menuIcon\":\"notebook\",\"level\":1,\"name\":\"学习\",\"parentId\":null,\"groupTitle\":null,\"sort\":3,\"type\":0,\"childrens\":[{\"id\":17,\"createTime\":\"2022-11-01 19:01:56\",\"updateTime\":\"2022-11-01 19:01:56\",\"isDel\":0,\"routerPath\":\"/article-list-page\",\"parentRouterName\":null,\"routerName\":\"ArticleListPage\",\"routerComponent\":\"ArticleListPage\",\"menuIcon\":null,\"level\":2,\"name\":\"文章\",\"parentId\":16,\"groupTitle\":\"\",\"sort\":1,\"type\":0,\"childrens\":[]}]},{\"id\":13,\"createTime\":\"2022-10-04 22:47:12\",\"updateTime\":\"2022-10-04 22:47:12\",\"isDel\":0,\"routerPath\":null,\"parentRouterName\":null,\"routerName\":null,\"routerComponent\":null,\"menuIcon\":\"setting\",\"level\":1,\"name\":\"系统设置\",\"parentId\":null,\"groupTitle\":null,\"sort\":4,\"type\":0,\"childrens\":[{\"id\":14,\"createTime\":\"2022-10-04 22:47:12\",\"updateTime\":\"2022-10-04 22:47:12\",\"isDel\":0,\"routerPath\":\"/update-timeline\",\"parentRouterName\":null,\"routerName\":\"UpdateTimelinePage\",\"routerComponent\":\"UpdateTimelinePage\",\"menuIcon\":null,\"level\":2,\"name\":\"系统更新历程\",\"parentId\":13,\"groupTitle\":\"记录\",\"sort\":1,\"type\":0,\"childrens\":[]},{\"id\":15,\"createTime\":\"2022-10-06 19:01:56\",\"updateTime\":\"2022-10-06 19:01:56\",\"isDel\":0,\"routerPath\":\"/system-setting\",\"parentRouterName\":null,\"routerName\":\"SystemSettingPage\",\"routerComponent\":\"SystemSettingPage\",\"menuIcon\":null,\"level\":2,\"name\":\"全局配置\",\"parentId\":13,\"groupTitle\":\"系统\",\"sort\":2,\"type\":0,\"childrens\":[]}]}],\"code\":\"200\",\"message\":\"处理成功\",\"otherMessage\":null,\"success\":true}"

  let obj = JSON.parse(jsonContent)
  let formatJson = jsonBeautify(obj, null, 2, 80)

  console.log(formatJson)
</script>

</html>